package com.jbm.onehome.common;

import com.jbm.core.common.*;
import com.jbm.core.iface.IAcross;
import com.jbm.core.iface.IP2P;
import com.jbm.onehome.iface.*;
import com.jbm.onehome.iface.enums.SellerType;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.math.BigDecimal;
import java.util.List;

/**
 * Created by lyh on 2017-05-17.
 */
public class OHInterface extends MainServer
{
    static
    {
        MainServer.setG_server(new OHInterface());
    }

    public static OHInterface getG_server()
    {
        return (OHInterface)MainServer.getG_server();
    }
    //    public static final OHInterface g_server = new OHInterface();
    private Integer m_local_id=AccountCtrl.Account_Server_id;
    public int login_id;
    public int member_id;

    public String account;
    public String pass;
    public  String nickname;
    public String logo;
    public int sex;
    public LoginEntity loginEntity;
    boolean islogin = false;

    public CallGroupEntity CreateGroup ( ConnectAgent... param )
    {
        CallGroupEntity ia = (CallGroupEntity) Remote(param, CallGroupEntity.class, AccountCtrl.Account_Server_id,"app_server",new CallGroupEntity("","jbm_s_call"),"Create",true,true,false,false);

        if ( ia.m_code == 200 )
            Remote(param, AccountCtrl.Account_Server_id, "app_server", new CallGroupEntity(ia.getCgId(),(CgUnitEntity)null), "Start", true, true,false,false);

        return ia;
    }

    public CallGroupEntity AddUnit( int cg_id, Integer login_id, Integer member_id, Integer seller_id, ConnectAgent... param )
    {
        return (CallGroupEntity) Remote(param, CallGroupEntity.class, AccountCtrl.Account_Server_id,"app_server",new CallGroupEntity(cg_id,new CgUnitEntity(cg_id,0,login_id,member_id,seller_id)),"AddUnit",true,true,false,false);
    }

    public CallGroupEntity DropUnit( int cg_id, int cgu_id, Integer login_id, Integer member_id, Integer seller_id, ConnectAgent... param )
    {
        return (CallGroupEntity) Remote(param, CallGroupEntity.class, AccountCtrl.Account_Server_id,"app_server",new CallGroupEntity(cg_id,new CgUnitEntity(cg_id,cgu_id,login_id,member_id,seller_id)),"DropUnit",true,true,false,false);
    }

    public CallGroupEntity GetUnitList ( int cg_id, ConnectAgent... param)
    {
        return (CallGroupEntity) Remote(param, CallGroupEntity.class, AccountCtrl.Account_Server_id,"app_server",new CallGroupEntity(cg_id,new CgUnitEntity(cg_id,0,null,null,null)),"GetUnitList",true,true,false,false);
    }

    public IAcross SendText (Integer cg_id, Integer receiver, String app_type, String msg, ConnectAgent... param )
    {
        int acc_id = 0;

        if ( MainServer.getG_server().getM_server_type() == MainServer.Server_type_Server )
        {
            if (param.length > 0)
            {
                IAccount ia = param[0].getM_iaccount();

                if (ia != null)
                    acc_id = ia.getM_account_id();
            }
        }else
            acc_id = MainServer.getG_server().getM_local_id();

        return Remote(param, AccountCtrl.Account_Server_id,"app_server",
                new IP2P(cg_id, acc_id, receiver, msg, true), "CGPushPoint", true, true,false,true);
    }

    public IAcross SendFile ( int cg_id, int login_id, String app_type, String filepath, String filename, String filetype, ConnectAgent... param )
    {
        int acc_id = 0;

        if ( MainServer.getG_server().getM_server_type() == MainServer.Server_type_Server )
        {
            if (param.length > 0)
            {
                IAccount ia = param[0].getM_iaccount();

                if (ia != null)
                    acc_id = ia.getM_account_id();
            }
        }else
            acc_id = MainServer.getG_server().getM_local_id();

        return Remote(param, IP2P.class, AccountCtrl.Account_Server_id,"app_server",
                new IP2P(cg_id, acc_id, login_id,
                        filepath,filename,filetype), "CGPushFile", true, true,true,true);
    }
    public ContactEntity AddContact( int self_id, Integer login_id, Integer member_id, Integer seller_id, ConnectAgent... param )
    {
        return (ContactEntity)Remote(param, ContactEntity.class,
                AccountCtrl.Account_Server_id,"app_server",new ContactEntity(self_id,login_id,member_id,seller_id),"AddContact",true,true);
    }

    public IAcross DropContact( int self_id, Integer login_id, Integer member_id, Integer seller_id, ConnectAgent... param )
    {
        return (IAcross) Remote(param, IAcross.class,
                AccountCtrl.Account_Server_id,"app_server",new ContactEntity(self_id,login_id,member_id,seller_id),"DropContact",true,true);
    }

    public ContactEntity GetContactList( int self_id, ConnectAgent... param )
    {
        ContactEntity ce = new ContactEntity();
        ce.setSelfId( self_id );
        return (ContactEntity)Remote(param, ContactEntity.class,
                AccountCtrl.Account_Server_id,"app_server",ce,"GetContactList",true,true);
    }

    public String login()
    {
        return Login ( account, pass);
    }

    public boolean islogin()
    {
        return islogin;
    }

    public void cancellogin()
    {
        islogin = false;
    }
    /********************账户信息****************************/

    //微信端登录
    public Login  wxlogin(String unionid,String openid, ConnectAgent... param)
    {

        Login login = (Login)Remote(param,Login.class,AccountCtrl.Account_Server_id,"app_server",new LoginEntity("", unionid,openid ),"wxlogin",true,true);


        if ( login.m_code == 200 )
        {
            this.login_id = login.login_id;
            this.member_id = login.member_id;
            this.islogin = true;
            this.logo=login.logo;
            this.nickname=login.nickname;
            this.sex=login.sex;

        }

        return login;

    }

    //登录
    public String Login( String name, String pass, ConnectAgent... param )
    {
        return Login(name,pass,"",param);
    }
    //登录 带微信openid
    public String Login( String name, String pass,String openid, ConnectAgent... param )
    {
        ILogin obj =new ILogin(name, pass);
        obj.oldpass= openid;
        Login login = (Login)Remote(param, Login.class,AccountCtrl.Account_Server_id,"app_server",obj,"login",true,true);

        if ( login.m_code == 200 )
        {
            this.login_id = login.login_id;
            this.member_id = login.member_id;

            this.account = name;
            this.pass = pass;
            this.islogin = true;
            this.logo=login.logo;
            this.nickname=login.nickname;
            this.sex=login.sex;
            return "Login OK";
        }

        return login.m_info;

    }
    //
    public IAcross ChangePass( String pass, String oldpass, ConnectAgent... param )
    {
        IAcross login = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",new ILogin("", pass, oldpass),"changepass",true,true);
        return login;

//        if ( login.m_code == 200 )
//        {
//            return "OK";
//        }
//
//        return "FAILED";
    }
    //设置密码
    public IAcross ResetPass ( String pass, String name, ConnectAgent... param )
    {
        IAcross login = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",new ILogin(name, pass, ""),"resetpass",true,true);
        return login;
//        if ( login.m_code == 200 )
//        {
//            return "OK";
//        }
//
//        return "FAILED";
    }
    //注册相关
    public Login RegistCustomer ( int login_id, String name, String pass, String repass, String ccode, boolean setsign ,String promotcode, ConnectAgent... param)
    {
        Login login = (Login)Remote(param, Login.class,AccountCtrl.Account_Server_id,"app_server",new IRegistCustomer( "reg_new", login_id, name, pass, repass, ccode, setsign,promotcode ),"reg_new",true,true);

        if ( login.m_code == 200 && login.login_id>0)
        {
            this.login_id = login.login_id;
            this.member_id = login.member_id;
            this.islogin = true;
            this.logo=login.logo;
            this.nickname=login.nickname;
            this.sex=login.sex;
        }

        return login;

    }

    public Login RegistCustomer ( int login_id, String name, String pass, String repass, String ccode, int vcode_id, String mm_unionid, String nickname, int sex,String logo,String promotcode, ConnectAgent... param )
    {

        Login login = (Login)Remote(param, Login.class,AccountCtrl.Account_Server_id,"app_server",new IRegistCustomer(  "bind_all", login_id, name, pass, repass, ccode, vcode_id, mm_unionid, nickname, sex ,logo,promotcode),"bind_all",true,true);

        if ( login.m_code == 200 && login.login_id>0)
        {
            this.login_id = login.login_id;
            this.member_id = login.member_id;
            this.islogin = true;
            this.logo=login.logo;
            this.nickname=login.nickname;
            this.sex=login.sex;
        }

        return login;

    }
    //同步微信 头像昵称 性别
    public Login SyncLogo ( int login_id, String nickname, String logo,  int sex, ConnectAgent... param)
    {
        Login login = (Login)Remote(param, Login.class,AccountCtrl.Account_Server_id,"app_server",new IRegistCustomer( "synclogo", login_id,  nickname,logo, sex ),"synclogo",true,true);
        return login;

    }

    //绑定手机号 获取验证码 微信端 使用 手机端微信登录使用
    public IVerifyCode CreateVCode ( String vvalue, String vtype, ConnectAgent... param )
    {
        IVerifyCode login = (IVerifyCode)Remote(param, IVerifyCode.class,AccountCtrl.Account_Server_id,"app_server",new IVerifyCode( "create", vvalue, vtype ),"create",true,true);
        return login;

    }
    //修改个人信息
    public IAcross ModPerInof(int loginid, String nickname,int sex, ConnectAgent... param)
    {
        LoginEntity log=new    LoginEntity("ModPerInof",loginid,nickname,sex);
        IAcross login = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",log,"ModPerInof",true,true);
        return login;
    }
    //更新头像
    public LoginEntity UpdateLogo(int loginid, byte[] bytes,String picname, ConnectAgent... param)
    {
        LoginEntity log=new    LoginEntity("UpdateLogo",loginid,bytes,picname);
        LoginEntity login = (LoginEntity)Remote(param, LoginEntity.class,AccountCtrl.Account_Server_id,"app_server",log,"UpdateLogo",true,true);
        return login;
    }
    //获得个人信息
    public LoginEntity getLoginInfo(int login_id, ConnectAgent... param)
    {
        LoginEntity login = (LoginEntity)Remote(param, LoginEntity.class,AccountCtrl.Account_Server_id,"app_server",new LoginEntity( "getinfo", login_id, "",   0 ),"getinfo",true,true);
        return login;


    }
    //退出登录
    public   IAcross Logout( ConnectAgent... param)
    {
        LoginEntity log=new    LoginEntity("Logout",0,null,null);
        IAcross login = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",log,"Logout",true,true);
        return login;
    }
    //新加 管理端登录
    public LoginEntity  loginm(String username,String password, ConnectAgent... param)
    {
        LoginEntity login = (LoginEntity)Remote(param, LoginEntity.class,AccountCtrl.Account_Server_id,"app_server",new LoginEntity("loginm", username,password ),"loginm",true,true);
        return login;


    }



//    //新加  绑定微信账号
//    public IAcross bindWxpay(String wxcount, ConnectAgent... param)
//    {
//        LoginEntity obj=new  LoginEntity();
//        obj.setWxAccount(wxcount);
//        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",     obj,"bindWxpay",true,true);
//
//        return jc;
//    }

//注册物业管理员
public Login registManager (  int login_id,String mobile, String pass, String repass, String ccode,String nickname,    ConnectAgent... param )
{

    Login login = (Login)Remote(param, Login.class,AccountCtrl.Account_Server_id,"app_server",new IRegistCustomer(   login_id,mobile, pass, repass,   ccode,nickname),"registManager",true,true);

    if ( login.m_code == 200 && login.login_id>0)
    {
        this.login_id = login.login_id;
        this.member_id = login.member_id;
        this.islogin = true;
        this.nickname=login.nickname;

    }

    return login;

}

  //加入物业小区
  public IAcross addtoUnit(  int login_id , ConnectAgent... param )
  {

      IAcross login = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",new CgUnitEntity(0,0,login_id,0,0),"addtoUnit",true,true);

      return login;

  }

    //群组内所有成员列表,带权限信息
    public LoginEntity getAllUnitPerson (ConnectAgent... param )
    {

        LoginEntity login = (LoginEntity)Remote(param, LoginEntity.class,AccountCtrl.Account_Server_id,"app_server",new LoginEntity( ),"getAllUnitPerson",true,true);

        return login;

    }

    //踢出组
    public IAcross removefromUnit(int login_id,ConnectAgent... param)
    {
        IAcross login = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",new CgUnitEntity(0,0,login_id,0,0),"removefromUnit",true,true);

        return login;
    }
    /*******************************工单*************************/
    //工单列表
    public IJOrderCtrl GetJOrderList ( int order_id, int start, int count, ConnectAgent... param)
    {
        IJOrderCtrl jc = (IJOrderCtrl)Remote(param, IJOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",  new IJOrder( "getlist", order_id, start, count),"getlist",true,true);

        return jc;
    }
    //工单列表
    public IJOrderCtrl GetJOrderList ( String status, int start, int count, ConnectAgent... param)
    {
        IJOrderCtrl jc = (IJOrderCtrl)Remote(param, IJOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",  new IJOrder(  "getlist", status, start, count),"getlist",true,true);

        return jc;


    }
    //新加 工单列表
    public IJOrderCtrl GetJOrderListN ( String status, int start, int count, ConnectAgent... param)
    {
        IJOrderCtrl jc = (IJOrderCtrl)Remote(param, IJOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",  new IJOrder( "getJobList", status, start, count),"getJobList",true,true);

        return jc;

    }
    //老 工单详细
    public IJOrder LoadJOrder ( int jorder_id , ConnectAgent... param)
    {
        IJOrder jc = (IJOrder)Remote(param, IJOrder.class,AccountCtrl.Account_Server_id,"app_server",  new IJOrder( "load", jorder_id),"load",true,true);

        return jc;


    }
    //新加 工单详细
    public JobOrderEntity LoadJOrderN ( int jorder_id , ConnectAgent... param)
    {

        JobOrderEntity jc = (JobOrderEntity)Remote(param, JobOrderEntity.class,AccountCtrl.Account_Server_id,"app_server", new IJOrder( "LoadJOrder", jorder_id),"LoadJOrder",true,true);

        return jc;

    }
    //中止工单
    public IJOrder BreakJob ( int jorder_id, String memo , ConnectAgent... param)
    {
        IJOrder jc = (IJOrder)Remote(param, IJOrder.class,AccountCtrl.Account_Server_id,"app_server",  new IJOrder( "breakjob", jorder_id,memo),"breakjob",true,true);

        return jc;


    }
    //提交工单
    public IJOrder SubmitJob ( int jorder_id, String amount, String job_sum, String guarantee_date , ConnectAgent... param)
    {
        IJOrder jc = (IJOrder)Remote(param, IJOrder.class,AccountCtrl.Account_Server_id,"app_server",  new IJOrder( "submit", jorder_id, amount, job_sum, guarantee_date),"submit",true,true);

        return jc;

    }

    //提交工单金额分材料费维修费
    public IJOrder SubmitJob ( int jorder_id, String job_amount, String job_sum, String item_amount, String item_sum, String guarantee_date , boolean pay, ConnectAgent... param)
    {
        BigDecimal bjob_amount = new BigDecimal(job_amount);
        BigDecimal bitem_amount = new BigDecimal(item_amount);

        BigDecimal bamount = bjob_amount.add(bitem_amount);
        IJOrder icall = new IJOrder( "submit", jorder_id, bamount.toString(), job_sum, guarantee_date);

        icall.job_amount = job_amount;
        icall.item_amount = item_amount;
        icall.item_sum = item_sum;
        icall.pay = pay;

        IJOrder jc = (IJOrder)Remote(param, IJOrder.class,AccountCtrl.Account_Server_id,"app_server",  icall,"submit",true,true);

        return jc;

    }

    //提交工单 使用代金券
    public IJOrder SubmitJob ( int jorder_id, String amount, String job_sum, String guarantee_date,int voucher,int voucher_id , ConnectAgent... param)
    {
        IJOrder jc = (IJOrder)Remote(param, IJOrder.class,AccountCtrl.Account_Server_id,"app_server",  new IJOrder( "submit", jorder_id, amount, job_sum, guarantee_date ,voucher,voucher_id),"submit",true,true);

        return jc;

    }
    //确定工单 手机端用
    public IJOrder ConfirmJob ( int jorder_id , ConnectAgent... param)
    {
        IJOrder jc = (IJOrder)Remote(param, IJOrder.class,AccountCtrl.Account_Server_id,"app_server",  new IJOrder("confirm", jorder_id ),"confirm",true,true);

        return jc;

    }

    //挂起工单后台 赞不用了
    public IJOrder HoldJob ( int jorder_id , ConnectAgent... param)
    {
        IJOrder jc = (IJOrder)Remote(param, IJOrder.class,AccountCtrl.Account_Server_id,"app_server",  new IJOrder("hold", jorder_id  ),"hold",true,true);

        return jc;


    }
    //挂起后继续后台 赞不用了
    public IJOrder ContinueJob ( int jorder_id , ConnectAgent... param)
    {
        IJOrder jc = (IJOrder)Remote(param, IJOrder.class,AccountCtrl.Account_Server_id,"app_server",  new IJOrder("continue", jorder_id  ),"continue",true,true);

        return jc;


    }
    //加预约时间
    public JobOrderEntity orderTime ( int jorder_id ,String ordertime, ConnectAgent... param)
    {
        JobOrderEntity jc = (JobOrderEntity)Remote(param, JobOrderEntity.class,AccountCtrl.Account_Server_id,"app_server",  new IJOrder(  jorder_id,ordertime  ),"orderTime",true,true);

        return jc;
    }

    /***********************订单***************************/
    //手机端 用 issave=ture 暂停 没有sellerid
    public IOrder CreateOrder ( int seller_id, int caddr_id, String item_desc, String type, String goods_code, boolean issave, String ordertime , ConnectAgent... param)
    {

        IOrder icall=new IOrder( "create", 0, member_id, seller_id, caddr_id, item_desc, type, "", goods_code, 0, 0, "", "" );
        icall.ordertime=ordertime;
        IOrder jc =null;
        if ( !issave ) //新建
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server", icall  ,"create",true,true);

        else
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   icall,"save",true,true);

        return jc;
    }
    //物业公司内部订单 gc_id 报修分类   ordertime预约时间可为空
    public IOrder createInOrder (String mobile,String address,String contacts, String item_desc, String type, int gc_id,   String ordertime , ConnectAgent... param)
    {

        IOrder icall=new IOrder(mobile,address,contacts,item_desc,type,gc_id,ordertime );
        icall.ordertime=ordertime;
        IOrder jc = (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server", icall  ,"CreateInOrder",true,true);
        return jc;
    }
    //cg_id  群id
    public IOrder CreateOrder ( int seller_id, int caddr_id, String item_desc, String type, String goods_code, boolean issave, String ordertime ,int cg_id , ConnectAgent... param)
    {

        IOrder icall=new IOrder( "create", 0, member_id, seller_id, caddr_id, item_desc, type, "", goods_code, 0, 0, "", "" );
        icall.ordertime=ordertime;
        icall.cg_id=cg_id;
        IOrder jc =null;
        if ( !issave ) //新建
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server", icall  ,"create",true,true);

        else
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   icall,"save",true,true);

        return jc;
    }
    // 加gi_type,t c j z
    public IOrder CreateOrder ( int seller_id, int caddr_id, String item_desc, String type, String goods_code, boolean issave, String ordertime ,int cg_id ,String gi_type, ConnectAgent... param)
    {

        IOrder icall=new IOrder( "create", 0, member_id, seller_id, caddr_id, item_desc, type, "", goods_code, 0, 0, "", "" );
        icall.ordertime=ordertime;
        icall.cg_id=cg_id;
        icall.gi_type=gi_type;
        IOrder jc =null;
        if ( !issave ) //新建
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server", icall  ,"create",true,true);

        else
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   icall,"save",true,true);

        return jc;
    }
    // 加gi_type,t c j z及 gc_id 报修分类
    public IOrder CreateOrder ( int seller_id, int caddr_id, String item_desc, String type, String goods_code, boolean issave, String ordertime ,int cg_id ,String gi_type,int gc_id, ConnectAgent... param)
    {

        IOrder icall=new IOrder( "create", 0, member_id, seller_id, caddr_id, item_desc, type, "", goods_code, 0, 0, "", "" );
        icall.ordertime=ordertime;
        icall.cg_id=cg_id;
        icall.gi_type=gi_type;
        icall.gc_id=gc_id;
        IOrder jc =null;
        if ( !issave ) //新建
            jc= (IOrder)Remote(param,IOrder.class,AccountCtrl.Account_Server_id,"app_server", icall  ,"create",true,true);

        else
            jc= (IOrder)Remote(param,IOrder.class,AccountCtrl.Account_Server_id,"app_server",   icall,"save",true,true);

        return jc;
    }

    //issave=true   暂停
    //管理端用到
    public IOrder CreateOrder ( int seller_id, int caddr_id, String item_desc, String type, String goods_code, boolean issave , ConnectAgent... param)
    {
        return CreateOrder( seller_id, caddr_id, item_desc, type, goods_code, issave, "", param);
    }

    public IOrder CreateOrder ( int seller_id, int caddr_id, String item_desc, String type, String goods_code,
                                boolean issave , String gi_type, String gcf_contract, String ext_order_code,String proxy,String proxy_mobile, String  dispatchDate,ConnectAgent... param)
    {
        SysLog.g_syslog.MakeLog(SysLog.SYS_LOG_LEVEL_DEBUG,"seller_id:"+seller_id+" caddr_id:"+caddr_id+" item_desc:"+item_desc+" type:"+type+" goods_code:"+goods_code+" issave:"+issave+" gi_type:"+gi_type+"gcf_contranct:"+gcf_contract);
        IOrder icall=new IOrder( "create", 0, member_id, seller_id, caddr_id, item_desc, type, "", goods_code, 0, 0, "", "" );
        icall.gi_type=gi_type;
        icall.gcf_contract = gcf_contract;
        icall.ext_order_code = ext_order_code;
        icall.proxy=proxy;
        icall.proxyMobile=proxy_mobile;
        icall.dispatchDate=dispatchDate;
        IOrder jc =null;
        if ( !issave ) //新建
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server", icall  ,"create",true,true);

        else
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   icall,"save",true,true);

        return jc;
    }

    public IOrder MyGuardHelp ( int caddr_id, String item_desc, boolean issave , ConnectAgent... param)
    {

        IOrder jc =null;
        if ( !issave ) //新建
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder( "create", 0, member_id, 0, caddr_id, item_desc, "guardhelp", "", "pub_ent_guard", 0, 0, "", "" ),"create",true,true);

        else
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder("save", 0, member_id, 0, caddr_id, item_desc, "guardhelp", "", "pub_ent_guard", 0, 0, "", "" ),"save",true,true);

        return jc;


    }
    //对讲门提交订单
    //微信端用到
    public IOrder MyGuardHelp ( int caddr_id, String item_desc , ConnectAgent... param)
    {

        IOrder jc = (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder( "create", 0, member_id, 0, caddr_id, item_desc, "guardhelp", "", "pub_ent_guard", 0, 0, "", "" ),"create",true,true);

        return jc;

    }

    public IOrder MyHBHouseHelp ( int caddr_id, String item_desc, String goods_code, boolean issave , ConnectAgent... param)
    {
        IOrder jc =null;
        if ( !issave ) //新建
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder( "create", 0, member_id, 0, caddr_id, item_desc, "hbhouse", "", goods_code, 0, 0, "", "" ),"create",true,true);

        else
            jc= (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder("save", 0, member_id, 0, caddr_id, item_desc, "hbhouse", "", goods_code, 0, 0, "", ""),"save",true,true);

        return jc;

    }

    //房管局订单
    //房管局用到
    public IOrder MyHBHouseHelp ( int caddr_id, String item_desc, String goods_code , ConnectAgent... param)
    {
        IOrder jc = (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder(  "create", 0, member_id, 0, caddr_id, item_desc, "hbhouse", "", goods_code, 0, 0, "", "" ),"create",true,true);

        return jc;
    }

    public IOrderCtrl GetMyOrder ( int order_id, String status, int start, int count , ConnectAgent... param)
    {
        IOrderCtrl jc = (IOrderCtrl)Remote(param, IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder(  "getlist", order_id, member_id, 0, 0, "", "", status, "", start, count, "", "" ),"getlist",true,true);

        return jc;

    }
    //老订单详细
    public IOrder LoadOrder ( int order_id , ConnectAgent... param)
    {
        IOrder jc = (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder( "load", order_id ),"load",true,true);

        return jc;

    }
    //新加    订单详细
    public IorderEntity LoadOrderInfo ( int order_id , ConnectAgent... param)
    {
        IorderEntity jc = (IorderEntity)Remote(param, IorderEntity.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder( "loadorder", order_id),"loadorder",true,true);

        return jc;

    }
    //作废订单  手机端用
    public IOrder RevokeOrder ( int order_id , ConnectAgent... param)
    {
        OrderLogEntity o=new OrderLogEntity();
        o.setOrderId(order_id);
        IOrder jc = (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   o,"revoke",true,true);

        return jc;


    }
    //新加 作废订单  管理端用
    public IOrder ForceRevokeOrder ( OrderLogEntity o, ConnectAgent... param)
    {

        IOrder jc = (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   o,"forcerevoke",true,true);

        return jc;

    }
    //评价 订单
    public IOrder CommentOrder ( int order_id, String desc, int speed_level, int quality_level, int attitude_level , ConnectAgent... param)
    {
        IOrder jc = (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder( "comment", order_id, desc, speed_level, quality_level, attitude_level),"comment",true,true);

        return jc;

    }
    //分派工单  更换施工队
    public IOrder CreateJobOrder ( int order_id, int seller_id , ConnectAgent... param)
    {
        IOrder jc = (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder( "createjob", order_id, seller_id),"createjob",true,true);

        return jc;

    }
    //强制更换施工队
    public IOrder ForceJobOrder ( int order_id, int seller_id , ConnectAgent... param)
    {
        IOrder jc = (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder(  "forcejob", order_id, seller_id ),"forcejob",true,true);

        return jc;
    }
    //老订单列表
    public IOrderCtrl GetOrderList ( String status, String start_date, String end_date, int start, int count , ConnectAgent... param)
    {
        IOrderCtrl jc = (IOrderCtrl)Remote(param, IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder( "getlist", 0, 0, 0, 0, "", "", status, "", start, count, start_date, end_date ),"getlist",true,true);

        return jc;


    }
    //新加 全部订单 管理端用
    public IOrderCtrl GetOrderListN ( String status, String start_date, String end_date, int start, int count ,int seller_id, Integer isTruned,Integer isSetterment, String gi_type, ConnectAgent... param)
    {
        IOrder o= new IOrder("getalllist", 0, 0, seller_id, 0, "", "", status, "", start, count, start_date, end_date);
        o.isTurned=isTruned;
        o.isSettlement=isSetterment;
        o.gi_type=gi_type;
        IOrderCtrl jc = (IOrderCtrl)Remote(param, IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",  o ,"getalllist",true,true);

        return jc;

    }


    //老订单列表
    public IOrderCtrl GetMyOrderList ( String status, String start_date, String end_date, int start, int count , ConnectAgent... param)
    {
        IOrderCtrl jc = (IOrderCtrl)Remote(param, IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder("getmylist", 0, 0, 0, 0, "", "", status, "", start, count, start_date, end_date),"getmylist",true,true);

        return jc;

    }
    //新加      我的订单列表
    public IOrderCtrl GetMyOrderListN ( String status, String start_date, String end_date, int start, int count , ConnectAgent... param)
    {
        IOrderCtrl jc = (IOrderCtrl)Remote(param, IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",    new IOrder( "getmyorderlist", 0, 0, 0, 0, "", "", status, "", start, count, start_date, end_date),"getmyorderlist",true,true);

        return jc;

    }
    //老评价列表
    public IOrderCtrl GetComList ( int start, int count , ConnectAgent... param)
    {
        IOrderCtrl jc = (IOrderCtrl)Remote(param, IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",    new IOrder(  "getcomlist", start, count),"getcomlist",true,true);

        return jc;

    }
    //新加 评价列表
    public IOrderCtrl getCommentList ( int start, int count , ConnectAgent... param)
    {
        IOrder order=new IOrder( "getCommentList", 0, 0 );
        order.start=start;
        order.count=count;
        IOrderCtrl jc = (IOrderCtrl)Remote(param, IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",    order,"getCommentList",true,true);

        return jc;
    }

    //创建鸡蛋订单
    public IOrder CreateSaleOrder ( int seller_id, int caddr_id, String item_desc, String type, String goods_code, int qty, String amount, int sact_id , ConnectAgent... param)
    {
        IOrder jc = (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",  new IOrder("create", member_id, seller_id, caddr_id, item_desc, type, "", goods_code, qty, amount, sact_id  ),"create",true,true);

        return jc;



    }
    //卖鸡蛋用
    public ISaleActivity LoadSaleActivity ( int sact_id , ConnectAgent... param)
    {
        ISaleActivity jc = (ISaleActivity)Remote(param, ISaleActivity.class,AccountCtrl.Account_Server_id,"app_server", new ISaleActivity( "load", sact_id ),"load",true,true);

        return jc;


    }

    //待上缴列表 管理端用
    public IOrderCtrl getNotTurnedList ( int seller_id,String start_date, String end_date, int start, int count, ConnectAgent... param )
    {
        IOrderCtrl jc = (IOrderCtrl)Remote(param,IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder(seller_id, start_date, end_date,start, count),"getNotTurnedList",true,true);

        return jc;
    }

    //上缴
    public IAcross doTurned(String ids, ConnectAgent... param)
    {
        IOrder o=new IOrder();
        o.order_code=ids;
        IAcross jc = (IAcross)Remote(param,IAcross.class,AccountCtrl.Account_Server_id,"app_server",     o,"doTurned",true,true);

        return jc;
    }

    //待结算列表 管理端用
    public IOrderCtrl getNotSetterList (int seller_id, String start_date, String end_date, int start, int count, ConnectAgent... param )
    {
        IOrderCtrl jc = (IOrderCtrl)Remote(param,IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IOrder(seller_id, start_date, end_date,start, count),"getNotSetterList",true,true);

        return jc;
    }

    //上缴
    public IAcross doSetter(String ids, ConnectAgent... param)
    {
        IOrder o=new IOrder();
        o.order_code=ids;
        IAcross jc = (IAcross)Remote(param,IAcross.class,AccountCtrl.Account_Server_id,"app_server",     o,"doSetter",true,true);

        return jc;
    }

    //回访记录

    public IAcross saveVisitLog(VisitlogsEntity o, ConnectAgent... param)
    {
        IAcross jc = (IAcross)Remote(param,IAcross.class,AccountCtrl.Account_Server_id,"app_server",     o,"saveVisitLog",true,true);

        return jc;
    }

    //回访记录列表
    public VisitlogsEntity getVisitLogList ( int order_id, ConnectAgent... param )
    {
        VisitlogsEntity jc = (VisitlogsEntity)Remote(param,VisitlogsEntity.class,AccountCtrl.Account_Server_id,"app_server",   new VisitlogsEntity( order_id),"getVisitLogList",true,true);

        return jc;
    }


    // 物业管理端  待分配列表
    public IOrderCtrl GetOrderListTempWY (String start_date, String end_date, int start, int count , ConnectAgent... param)
    {
        IOrderCtrl jc = (IOrderCtrl)Remote(param, IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",    new IOrder(  0, start_date, end_date,start, count  ),"GetOrderListTempWY",true,true);

        return jc;

    }
    // 物业管理端  其他订单
    public IOrderCtrl GetOrderListOtherWY (String start_date, String end_date, int start, int count , ConnectAgent... param)
    {
        IOrderCtrl jc = (IOrderCtrl)Remote(param, IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",    new IOrder(  0, start_date, end_date,start, count  ),"GetOrderListOtherWY",true,true);

        return jc;

    }
    // 物业管理端  家帮忙订单
    public IOrderCtrl GetOrderListJBMWY (String start_date, String end_date, int start, int count , ConnectAgent... param)
    {
        IOrderCtrl jc = (IOrderCtrl)Remote(param, IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",    new IOrder(  0, start_date, end_date,start, count  ),"GetOrderListJBMWY",true,true);

        return jc;

    }

//一键转家帮忙
    public IOrder CreateOrder ( int order_id , ConnectAgent... param)
    {

        IOrder icall=new IOrder( "CreateOrder",  order_id);

        IOrder jc  = (IOrder)Remote(param, IOrder.class,AccountCtrl.Account_Server_id,"app_server",   icall,"CreateOrder",true,true);

        return jc;
    }
    /************************住址*****************************/
    //添加住址
    public ICertAddress AddMyCAddr (          int gi_id,
                                              String gi_addon,
                                              String gi_text,
                                              String zip_code,
                                              String contacts,
                                              String mobile,
                                              String phone,
                                              ConnectAgent... param
    )
    {
        return AddMyCAddr(gi_id,gi_addon,gi_text,zip_code,contacts,mobile,phone,"t",param);

    }
    //带住址类别 c z j t
    public ICertAddress AddMyCAddr (          int gi_id,
                                              String gi_addon,
                                              String gi_text,
                                              String zip_code,
                                              String contacts,
                                              String mobile,
                                              String phone,
                                              String gi_type,
                                              ConnectAgent... param
    )
    {
        ICertAddress o=new ICertAddress( "create", 0, member_id, gi_id, gi_addon, gi_text, zip_code, contacts, mobile, phone );
        o.gi_type=gi_type;
        ICertAddress jc = (ICertAddress)Remote(param, ICertAddress.class,AccountCtrl.Account_Server_id,"app_server", o ,"create",true,true);

        return jc;

    }

    //添加免费认证住址
    public ICertAddress AddMyFreeFeeCAddr (          int gi_id,
                                                     String gi_addon,
                                                     String gi_text,
                                                     String zip_code,
                                                     String contacts,
                                                     String mobile,
                                                     String phone,
                                                     ConnectAgent... param
    )
    {
        ICertAddress jc = (ICertAddress)Remote(param, ICertAddress.class,AccountCtrl.Account_Server_id,"app_server",  new ICertAddress( "create", 0, member_id, gi_id, gi_addon, gi_text, zip_code, contacts, mobile, phone, "freefee"  ),"create",true,true);

        return jc;

    }
    //我的地址信息
    public ICertAddressCtrl GetMyCAddr ( int caddr_id , ConnectAgent... param)
    {
        ICertAddressCtrl jc = (ICertAddressCtrl)Remote(param,ICertAddressCtrl.class,AccountCtrl.Account_Server_id,"app_server",  new ICertAddress( "getlist", caddr_id, member_id, 0, "", "", "", "", "", ""  ),"getlist",true,true);

        return jc;

    }
    //带类型 c z j t
    public ICertAddressCtrl GetMyCAddr ( int caddr_id ,String  gi_type, ConnectAgent... param)
    {
        ICertAddress o=new ICertAddress( "getlist", caddr_id, member_id, 0, "", "", "", "", "", ""  );
        o.gi_type=gi_type;
        ICertAddressCtrl jc = (ICertAddressCtrl)Remote(param, ICertAddressCtrl.class,AccountCtrl.Account_Server_id,"app_server", o ,"getlist",true,true);

        return jc;
    }

    public ICertAddressCtrl GetCAddrList ( int member_id, int gi_id, String gi_addon, String gi_text, String zip_code, String contacts, String mobile, String phone, String cert_status , ConnectAgent... param)
    {
        ICertAddressCtrl jc = (ICertAddressCtrl)Remote(param, ICertAddressCtrl.class,AccountCtrl.Account_Server_id,"app_server",  new ICertAddress( "getlist", 0, 0, 0, "", "", "", "", "", "", cert_status ),"getlist",true,true);

        return jc;

    }

    //已确认申请列表 门禁申请
    public ICertAddressCtrl GetConfrimList ( ConnectAgent... param)
    {

        ICertAddressCtrl jc = (ICertAddressCtrl)Remote(param, ICertAddressCtrl.class,AccountCtrl.Account_Server_id,"app_server",  new ICertAddress( "getconfirmlist", 0, 0, 0, "", "", "", "", "", "" ),"getconfirmlist",true,true);

        return jc;


    }

    public ICertAddress FreeFeeConfirm (     int caddr_id,
                                             String gi_text,
                                             ConnectAgent... param
    )
    {

        ICertAddress jc = (ICertAddress)Remote(param, ICertAddress.class,AccountCtrl.Account_Server_id,"app_server",  new ICertAddress(  "ffconfirm", caddr_id, 0, 0, "", gi_text, "", "", "", ""),"ffconfirm",true,true);

        return jc;
    }

    public String FreeFeeComplete ( String address , ConnectAgent... param)
    {
        ICertAddress jc = (ICertAddress)Remote(param, ICertAddress.class,AccountCtrl.Account_Server_id,"app_server",  new ICertAddress( "ffcomplete", 0, 0, 0, "", address, "", "", "", ""),"ffcomplete",true,true);
        if(jc.m_code==200)
        {
            return "OK";
        }
        return jc.m_info;
    }

    public ICertAddress RemoveMyCAddr ( int caddr_id, int member_id , ConnectAgent... param)
    {
        ICertAddress jc = (ICertAddress)Remote(param, ICertAddress.class,AccountCtrl.Account_Server_id,"app_server",  new ICertAddress( "delete", caddr_id, member_id),"delete",true,true);

        return jc;


    }

    public ICertAddress UpdateMyCAddr (     int caddr_id,
                                            int gi_id,
                                            String gi_addon,
                                            String gi_text,
                                            String zip_code,
                                            String contacts,
                                            String mobile,
                                            String phone,
                                            ConnectAgent... param
    )
    {
        ICertAddress jc = (ICertAddress)Remote(param, ICertAddress.class,AccountCtrl.Account_Server_id,"app_server",  new ICertAddress("update", caddr_id, member_id, gi_id, gi_addon, gi_text, zip_code, contacts, mobile, phone),"update",true,true);

        return jc;
    }

    /****************商家*********************/


    public ISeller GetMyselfSeller ( ConnectAgent... param)//type in "owner", "normal", "manager, Obje"
    {
        ISeller jc = (ISeller)Remote(param, ISeller.class,AccountCtrl.Account_Server_id,"app_server",  new ISeller( "loadmyself" ),"loadmyself",true,true);

        return jc;
    }

    public ISeller LoadSeller ( int seller_id,
                                ConnectAgent... param )//type in "owner", "normal", "manager"
    {
        ISeller jc = (ISeller)Remote(param, ISeller.class,AccountCtrl.Account_Server_id,"app_server",  new ISeller("load", seller_id  ),"load",true,true);

        return jc;


    }

    public ISeller EmployeeJoinSeller ( int seller_id, int emp_id, String emp_role,
                                        ConnectAgent... param )//type in "owner", "normal", "manager"
    {
        ISeller jc = (ISeller)Remote(param, ISeller.class,AccountCtrl.Account_Server_id,"app_server",  new ISeller("joinemployee", seller_id, emp_id, emp_role ),"joinemployee",true,true);

        return jc;
    }

    public ISeller SellerRecharge ( int seller_id, String amount , ConnectAgent... param)
    {
        ISeller jc = (ISeller)Remote(param, ISeller.class,AccountCtrl.Account_Server_id,"app_server",  new ISeller("recharge", seller_id, amount ),"recharge",true,true);

        return jc;
    }
//创建个人施工队
    public ISeller CreatePersonalSeller (
            int prev_seller,
            String seller_code,
            String name,
            String phone,
            String mobile,
            String email,
            String QQ,
            String address,
            ConnectAgent... param
    )
    {
        ISeller jc = (ISeller)Remote(param, ISeller.class,AccountCtrl.Account_Server_id,"app_server",  new ISeller("createpersonal", prev_seller, 0, seller_code, name,phone,mobile,email,QQ,address,"","","","", 0, 0  ),"createpersonal",true,true);

        return jc;

    }
    //创建物业下施工队 login_id  被加入施工队人的id prev_id 上一级施工队sellerid
    public ISeller createSeller (int prev_id,  int login_id ,ConnectAgent... param  )
    {
        ISeller jc = (ISeller)Remote(param, ISeller.class,AccountCtrl.Account_Server_id,"app_server",  new ISeller("createSeller", prev_id, login_id, ""),"createSeller",true,true);

        return jc;

    }
    public ISellerCtrl GetSellerList ( String type, int start, int count , ConnectAgent... param)
    {
        ISellerCtrl jc = (ISellerCtrl)Remote(param, ISellerCtrl.class,AccountCtrl.Account_Server_id,"app_server",  new ISeller("getlist", 0, 0, "", "","","","","","","",type,"","", start, count ),"getlist",true,true);

        return jc;

    }
    public ISellerCtrl GetSellerList ( String type,String seller_type, int start, int count , ConnectAgent... param)
    {
        ISeller o=  new ISeller("getlist", 0, 0, "", "","","","","","","",type,"","", start, count );
        o.sellerType=seller_type;
        ISellerCtrl jc = (ISellerCtrl)Remote(param, ISellerCtrl.class,AccountCtrl.Account_Server_id,"app_server", o ,"getlist",true,true);

        return jc;

    }

    public ISellerCtrl GetSellerListByTypes ( String types, int start, int count , ConnectAgent... param)
    {

        ISellerCtrl jc = (ISellerCtrl)Remote(param, ISellerCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new ISeller( "getlist", types, start, count ),"getlist",true,true);

        return jc;

    }
    public ISellerCtrl GetSellerListByTypes ( String types,String seller_type, int start, int count , ConnectAgent... param)
    {
        ISeller o=new ISeller( "getlist", types, start, count );
        o.sellerType=seller_type;
        ISellerCtrl jc = (ISellerCtrl)Remote(param, ISellerCtrl.class,AccountCtrl.Account_Server_id,"app_server",  o ,"getlist",true,true);

        return jc;

    }

    public IPayCtrl GetMyPay ( String type, int start, int count, String start_date, String end_date , ConnectAgent... param)
    {
        IPayCtrl jc = (IPayCtrl)Remote(param, IPayCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IPay( "getmylist", 0, 0, "", "","","","","", start, count, start_date, end_date ),"getmylist",true,true);

        return jc;

    }

    public IPayCtrl GetSellerPay ( int seller_id, String type, int start, int count, String start_date, String end_date , ConnectAgent... param)
    {
        IPayCtrl jc = (IPayCtrl)Remote(param, IPayCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IPay( "getlist", 0, seller_id, "seller", "","","","","", start, count, start_date, end_date),"getlist",true,true);

        return jc;
    }
    //施工队统计
    public IJobTotal JobTotalList ( int start, int count, String start_date, String end_date , ConnectAgent... param)
    {
        IJobTotal jc = (IJobTotal)Remote(param, IJobTotal.class,AccountCtrl.Account_Server_id,"app_server",   new ITotal( "jobtotal", start, count, start_date, end_date),"jobtotal",true,true);

        return jc;


    }

    //获得所在组 主seller

    public SellerEntity getMSeller (  ConnectAgent... param)
    {
        SellerEntity jc = (SellerEntity)Remote(param, SellerEntity.class,AccountCtrl.Account_Server_id,"app_server",   new SellerEntity(),"getMSeller",true,true);
        return jc;

    }
    //下级施工队列表 prev_id 主seller 的sellerId isAuth是否判断权限 默认否
    public ISellerCtrl GetSubSellerList (int prev_id , boolean isAuth, ConnectAgent... param)
    {
        SellerEntity o= new SellerEntity();
        o.setSellerId(prev_id);
        o.setHc(isAuth?1:0);
        ISellerCtrl jc = (ISellerCtrl)Remote(param, ISellerCtrl.class,AccountCtrl.Account_Server_id,"app_server", o ,"GetSubSellerList",true,true);
        return jc;

    }



    /**********************商品*********************/
    //根据上一级id获得商品类别列表
    public GoodsClassEntity getGoodsListByPrev ( int prev_id, ConnectAgent... param)
    {GcGcHstyEntity o=new GcGcHstyEntity();
        o.setPrevId(prev_id);
        GoodsClassEntity jc = (GoodsClassEntity)Remote(param, GoodsClassEntity.class,AccountCtrl.Account_Server_id,"app_server",  o  ,"getGoodsListByPrev",true,true);
        return jc;
    }

    //根据上一级code 获得商品类别列表
    public GoodsClassEntity getGoodsListByPrevCode ( String prev_code, ConnectAgent... param)
    {
        GoodsClassEntity o=new GoodsClassEntity();
        o.setGcCode(prev_code);
        GoodsClassEntity jc = (GoodsClassEntity)Remote(param,GoodsClassEntity.class,AccountCtrl.Account_Server_id,"app_server",  o  ,"getGoodsListByPrevCode",true,true);

        return jc;
    }

    //根据上一级code 及报修通道 获得商品列表 c z j t
    public GoodsEntity getGoodsList  ( String prev_code,String gi_type, ConnectAgent... param)
    {
        GoodsClassEntity o=new GoodsClassEntity();
        o.setGcCode(prev_code);
        o.setGcType(gi_type); //借用字段
        GoodsEntity jc = (GoodsEntity)Remote(param,GoodsEntity.class,AccountCtrl.Account_Server_id,"app_server",  o  ,"getGoodsList",true,true);

        return jc;
    }

    /**********************门禁*********************/
    public IEGuardKeyCtrl GetMyEGuardKey ( ConnectAgent... param)
    {
        IEGuardKeyCtrl jc = (IEGuardKeyCtrl)Remote(param, IEGuardKeyCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IEGuardKey( "getmylist", 0, 0, 0, 0, 0, 0, "", "", "", "", "", "", 0, 0, "", "" ),"getmylist",true,true);

        return jc;
    }
    //认证
    public IEGuardKey RegistKeyWithIDCard ( int caddr_id, String card_nom, String name, String id_card , ConnectAgent... param)
    {
        IEGuardKey jc = (IEGuardKey)Remote(param, IEGuardKey.class,AccountCtrl.Account_Server_id,"app_server",   new   IEGuardKey( "create", caddr_id, card_nom, name, id_card ),"create",true,true);

        return jc;

    }
    //分发 授权
    public IEGuardKey ShareEGuardKey ( int egkey_id, int open_total, String open_date, String expire_date, String mobile, String name, String id_card , ConnectAgent... param)
    {
        IEGuardKey jc = (IEGuardKey)Remote(param, IEGuardKey.class,AccountCtrl.Account_Server_id,"app_server",   new   IEGuardKey( "create_share", egkey_id, 0, 0, open_total, 0, 0, open_date, expire_date, "", mobile, name, id_card, 0, 0, "", "" ),"create_share",true,true);

        return jc;
    }

    public IEGuardKey GetSafeKey ( String mac , ConnectAgent... param)
    {
        IEGuardKey jc = (IEGuardKey)Remote(param, IEGuardKey.class,AccountCtrl.Account_Server_id,"app_server",   new   IEGuardKey( "getsafekey", mac),"getsafekey",true,true);

        return jc;

    }
    public String UploadEGuardLog ( IEGLogCtrl egllist , ConnectAgent... param)
    {
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",   egllist,"upload",true,true);
        if(jc.m_code==200)
        {
            return "OK";
        }
        else
        {
            return jc.m_info;
        }


    }

    public IEGLogCtrl GetMyEGLog ( ConnectAgent... param)
    {
        IEGLogCtrl jc = (IEGLogCtrl)Remote(param, IEGLogCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IEGLog( "getmylist", 0 ),"getmylist",true,true);

        return jc;

    }



    public IEGuard CreateEGuard ( int area_id, int vil_id, String village, int unit_id, String unit, String mac, String open_key, String door_no, String bt_no , ConnectAgent... param)
    {
        IEGuard jc = (IEGuard)Remote(param, IEGuard.class,AccountCtrl.Account_Server_id,"app_server",   new IEGuard( "create", area_id, vil_id, village, unit_id, unit, mac, open_key, door_no, bt_no ),"create",true,true);

        return jc;


    }

    public IEGuard LoadEGuard ( int eguard_id, int gi_id , ConnectAgent... param)
    {

        IEGuard jc = (IEGuard)Remote(param, IEGuard.class,AccountCtrl.Account_Server_id,"app_server",   new IEGuard("load", eguard_id, gi_id ),"load",true,true);

        return jc;
    }

    public IEGuard UpdateEGuard ( int eguard_id, int ebt_id, String mac, String bt_no , ConnectAgent... param)
    {
        IEGuard jc = (IEGuard)Remote(param, IEGuard.class,AccountCtrl.Account_Server_id,"app_server",   new IEGuard("update", eguard_id, ebt_id, mac, bt_no),"update",true,true);

        return jc;

    }



//创建开门key 企业开门
    public IEGuardKey RegistKey ( String key, ConnectAgent... param)
    {
        IEGuardKey o=  new   IEGuardKey(  );
        o.open_key=key;
        IEGuardKey jc = (IEGuardKey)Remote(param, IEGuardKey.class,AccountCtrl.Account_Server_id,"app_server",   o,"RegistKey",true,true);

        return jc;
    }

    // 授权 企业开门
    public IEGuardKey authEGuardKey ( int egkey_id, int userid ,ConnectAgent... param)
    {
        IEGuardKey o=  new   IEGuardKey(  );
        o.egkey_id=egkey_id;
        o.login_id=userid;

        IEGuardKey jc = (IEGuardKey)Remote(param, IEGuardKey.class,AccountCtrl.Account_Server_id,"app_server",   o,"authEGuardKey",true,true);

        return jc;
    }
    // 授权 企业开门
    public IEGuardKey authEGuardKey ( int egkey_id, String mobile,ConnectAgent... param)
    {
        IEGuardKey o=  new   IEGuardKey(  );
        o.egkey_id=egkey_id;
        o.mobile=mobile;

        IEGuardKey jc = (IEGuardKey)Remote(param, IEGuardKey.class,AccountCtrl.Account_Server_id,"app_server",   o,"authEGuardKey",true,true);

        return jc;
    }
    //删除授权  企业开门 keyids：(逗号分隔的id 如4,5,2,6,3)
    public IEGuardKey removeEGuardKey ( String  keyids ,ConnectAgent... param)
    {
        IEGuardKey o=  new   IEGuardKey(  );
        o.open_key=keyids;

        IEGuardKey jc = (IEGuardKey)Remote(param, IEGuardKey.class,AccountCtrl.Account_Server_id,"app_server",   o,"removeEGuardKey",true,true);

        return jc;
    }

    //   企业开门  我的设备列表
    public EguardKeyEntity getMyMainEguardList (  ConnectAgent... param)
    {
        EguardKeyEntity jc = (EguardKeyEntity)Remote(param, EguardKeyEntity.class,AccountCtrl.Account_Server_id,"app_server",   new   IEGuardKey(  ),"getMyMainEguardList",true,true);

        return jc;
    }


    //   企业开门  设备下人员列表
    public EguardKeyEntity getEguardUserList (  int eguard_id , ConnectAgent... param)
    {
        IEGuardKey o=  new   IEGuardKey(  );
        o.eguard_id=eguard_id;

        EguardKeyEntity jc = (EguardKeyEntity)Remote(param, EguardKeyEntity.class,AccountCtrl.Account_Server_id,"app_server",  o,"getEguardUserList",true,true);

        return jc;
    }
    /***********************后台统计******************************/
     /*注册及开门情况日统计
      * startdate  可空
      * enddate, 可空
      * start  可空
      * count 可空
      * */
    public IStatCtrl GetStatDayEGuard ( StatisticalReportEntity obj , ConnectAgent... param)
    {
        IStatCtrl jc = (IStatCtrl)Remote(param, IStatCtrl.class,AccountCtrl.Account_Server_id,"app_server",   obj,"getlist",true,true);

        return jc;

    }
    /* 开门记录统计
      * startdate   可空
      * enddate, 可空
      * start  可空
      * count 可空
      * */
    public IStatCtrl GetStatEGuardLog ( VEguardLogEntity obj , ConnectAgent... param)
    {
        IStatCtrl jc = (IStatCtrl)Remote(param, IStatCtrl.class,AccountCtrl.Account_Server_id,"app_server",   obj,"getlist",true,true);

        return jc;
    }
    /* 故障门统计*/
    public IStatCtrl GetStatBrokenEGuard ( ConnectAgent... param)
    {
        IStatCtrl jc = (IStatCtrl)Remote(param, IStatCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IStatBrokenEGuard( "getlist" ),"getlist",true,true);

        return jc;

    }


    /*小区开门状况统计
 * startdate  可空
 * enddate, 可空
 * gi_Id 必填
 * gi_name 必填
 * */
    public IStatCtrl GetVillage ( String startdate,String enddate ,int gi_Id,String gi_name, ConnectAgent... param)
    {
        IStatCtrl jc = (IStatCtrl)Remote(param, IStatCtrl.class,AccountCtrl.Account_Server_id,"app_server", new IStatVillage("getlist",startdate,enddate, gi_Id,gi_name),"getlist",true,true);

        return jc;

    }
    /*小区开门状况统计
* startdate  可空
* enddate, 可空
* gi_Id 必填
* gi_name 必填
* */
    public IStatCtrl GetStatVillPerson ( String startdate,String enddate ,int gi_Id, ConnectAgent... param)
    {
        IStatCtrl jc = (IStatCtrl)Remote(param, IStatCtrl.class,AccountCtrl.Account_Server_id,"app_server", new IStatVillage("getperson",startdate,enddate, gi_Id,""),"getperson",true,true);

        return jc;


    }

    /* 开门记录统计
     * login_id   必填
      * startdate   可空
      * enddate, 可空
      * start  可空
      * count 可空
      * */
    public IEGLogCtrl GetStatEGuardLogByPerson ( IStatEGuardLog obj , ConnectAgent... param)
    {
        IEGLogCtrl jc = (IEGLogCtrl)Remote(param, IEGLogCtrl.class,AccountCtrl.Account_Server_id,"app_server", obj,"getpersonlist",true,true);

        return jc;

    }
   /*获得人员列表
      mobile 必填
    */

    public ISecretCtrl getPersonList ( ISecret obj , ConnectAgent... param)
    {
        ISecretCtrl jc = (ISecretCtrl)Remote(param, ISecretCtrl.class,AccountCtrl.Account_Server_id,"app_server", obj,"getlist",true,true);

        return jc;

    }
    /*********************信息发布************************/
     /*发布信息
       typeId,  content,  phoneModule,  status=1,  scopeList  ,attList(attOrgname,picByte,picType)
    */
    public IAcross AddInfomation (InfomationEntity obj , ConnectAgent... param)
    {
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"AddInfomation",true,true);

        return jc;


    }


    /* 获得信息列表
    status 状态  0 草稿 1发布 2待审核 ，默认传null
    type_id 信息分类，见枚举  可传null
    gi_id   当前小区id
    start
     pagesize每页行数
 */
    public IInformationCtrl GetInfoList (Integer status,Integer type_id,int gi_id,int start,int pagesize, ConnectAgent... param)
    {
        InfomationEntity obj=new    InfomationEntity(status,type_id,gi_id,start,pagesize);

        IInformationCtrl jc = (IInformationCtrl)Remote(param, IInformationCtrl.class,AccountCtrl.Account_Server_id,"app_server", obj,"GetInfoList",true,true);

        return jc;

    }

    /* 获得信息列表
未登录获取全部 没有地址获取全部
*/
    public IInformationCtrl GetInfoList (Integer status,Integer type_id,int start,int pagesize, ConnectAgent... param)
    {
        InfomationEntity obj=new    InfomationEntity(status,type_id,start,pagesize);

        IInformationCtrl jc = (IInformationCtrl)Remote(param, IInformationCtrl.class,AccountCtrl.Account_Server_id,"app_server", obj,"GetInfoListByLogin",true,true);

        return jc;

    }

    /* 获得我的信息列表
  status 状态  0 草稿 1发布 2待审核 3违规退回 ，默认传null
  type_id 信息分类，见枚举  可传null
  start
   pagesize每页行数
*/
    public IInformationCtrl GetMyInfoList (Integer status,Integer type_id,int start,int pagesize, ConnectAgent... param)
    {
        InfomationEntity obj=new    InfomationEntity(status,type_id,start,pagesize);

        IInformationCtrl jc = (IInformationCtrl)Remote(param, IInformationCtrl.class,AccountCtrl.Account_Server_id,"app_server", obj,"GetMyInfoList",true,true);

        return jc;


    }

    /*
审核信息
status（0草稿  2待审 1发布 3违规退回）
*/
    public IAcross AuditInfomation (InfoAuditLogEntity obj , ConnectAgent... param)
    {
        obj.method="AuditInfomation";
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"AuditInfomation",true,true);

        return jc;


    }
    /*
待审核信息列表
*/
    public IInformationCtrl GetAuditInfoList (int start,int pagesize, ConnectAgent... param)
    {
        InfomationEntity obj=new    InfomationEntity(2,null,start,pagesize);

        IInformationCtrl jc = (IInformationCtrl)Remote(param, IInformationCtrl.class,AccountCtrl.Account_Server_id,"app_server", obj,"GetAuditInfoList",true,true);

        return jc;

    }

    //搜索信息
    public IInformationCtrl GetInfoListBySearch (String content,int gi_id, int start,int pagesize, ConnectAgent... param)
    {
        InfomationEntity obj=new    InfomationEntity(content,start,pagesize);

        obj.setGiId(gi_id) ;
        IInformationCtrl jc = (IInformationCtrl)Remote(param, IInformationCtrl.class,AccountCtrl.Account_Server_id,"app_server", obj,"GetInfoListBySearch",true,true);

        return jc;

    }
    //搜索信息 未登录获取全部 没有地址获取全部
    public IInformationCtrl GetInfoListBySearch (String content,  int start,int pagesize, ConnectAgent... param)
    {
        InfomationEntity obj=new    InfomationEntity(content,start,pagesize);

        IInformationCtrl jc = (IInformationCtrl)Remote(param, IInformationCtrl.class,AccountCtrl.Account_Server_id,"app_server", obj,"GetInfoListByLogin",true,true);

        return jc;

    }
    //按关键字查询商家 信息列表
    public IInformationCtrl getBusInfoListBySearch (String key, int start,int pagesize, ConnectAgent... param)
    {
        InfomationEntity obj=new    InfomationEntity(key,start,pagesize);
        obj.method="GetBusInfoListBySearch";

        IInformationCtrl jc = (IInformationCtrl)Remote(param, IInformationCtrl.class,AccountCtrl.Account_Server_id,"app_server", obj,"GetBusInfoListBySearch",true,true);

        return jc;


    }
    //刷新信息
    public IAcross RefreshInfo(int infoid, ConnectAgent... param)
    {
        InfomationEntity obj=new    InfomationEntity("RefreshInfo",infoid);


        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"RefreshInfo",true,true);

        return jc;
    }
    //修改信息
    //
    public IAcross UpdateInfo(int infoid,Integer typeId,String content,String phoneModule,Integer status,List<GeoInfoEntity> scopeList,List<InfoAttachmentEntity> attlist, ConnectAgent... param)
    {
        InfomationEntity obj=new    InfomationEntity("UpdateInfo",infoid,typeId,content,phoneModule,status,scopeList,attlist);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"UpdateInfo",true,true);

        return jc;
    }

    /* 获得我的收藏列表
   start
   pagesize每页行数
*/
    public IInformationCtrl GetMyFocusInfoList (int start,int pagesize, ConnectAgent... param)
    {
        InfomationEntity obj=new    InfomationEntity(null,null,start,pagesize);


        IInformationCtrl jc = (IInformationCtrl)Remote(param, IInformationCtrl.class,AccountCtrl.Account_Server_id,"app_server", obj,"GetMyFocusInfoList",true,true);

        return jc;


    }
    //删除信息
    public IAcross DelInfo(int infoid, ConnectAgent... param)
    {
        InfomationEntity obj=new    InfomationEntity("DelInfo",infoid);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"DelInfo",true,true);

        return jc;
    }
    //信息点赞
    // praiseType见枚举 信息类=1
    public IAcross InfoPraise(int infoid,int loginid,int praiseType, ConnectAgent... param)
    {
        PraiseEntity obj=new   PraiseEntity("InfoPraise",infoid,loginid,praiseType);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"InfoPraise",true,true);

        return jc;
    }
    //收藏
    // praiseType见枚举 信息类=1
    public IAcross InfoFocus(int infoid,int loginid,int praiseType, ConnectAgent... param)
    {
        FocusEntity obj=new   FocusEntity("InfoFocus",infoid,loginid,praiseType);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"InfoFocus",true,true);

        return jc;
    }
    //取消收藏
    public IAcross  FocusCancel(int infoid,int loginid,int praiseType, ConnectAgent... param)
    {
        FocusEntity obj=new   FocusEntity("FocusCancel",infoid,loginid,praiseType);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"FocusCancel",true,true);

        return jc;
    }
    /*
    注册商家
  status（0 待审 1发布 2违规退回）
 */
    public IAcross AddBusiness (SellerEntity obj , ConnectAgent... param)
    {
        obj.method="AddBusiness";
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"AddBusiness",true,true);

        return jc;
    }
    /*
注册商家
status（temp 待审 able发布  unable违规退回）
*/
    public IAcross AddBusiness (String bus_name,String bus_address,String servicestyle,String sellerscope,String filename,byte[] picbytes, ConnectAgent... param)
    {
        SellerEntity obj=new  SellerEntity(0,bus_name,bus_address,servicestyle,sellerscope,filename,picbytes,"", SellerType.business.toString());

        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"AddBusiness",true,true);

        return jc;
    }
    //待审核商家列表
    public ISellerCtrl GetAuditBusList ( ConnectAgent... param)
    {
        SellerEntity obj=new    SellerEntity();
        ISellerCtrl jc = (ISellerCtrl)Remote(param, ISellerCtrl.class,AccountCtrl.Account_Server_id,"app_server", obj,"GetAuditBusList",true,true);

        return jc;

    }

    /*
 审核商家
status（0 待审 1发布 2违规退回）
*/
    public IAcross AuditBusiness (BusAuditLogEntity obj , ConnectAgent... param)
    {

        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"AuditBusiness",true,true);

        return jc;
    }
    //修改商家
    public IAcross ModBusiness (int bus_id,String bus_name,String bus_address,String servicestyle,String sellerscope,String filename,byte[] picbytes , ConnectAgent... param)
    {
        SellerEntity obj=new  SellerEntity(bus_id,bus_name,bus_address,servicestyle,sellerscope,filename,picbytes,"", SellerType.business.toString());
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server", obj,"ModBusiness",true,true);

        return jc;
    }
    //获得商家信息
    public SellerEntity GetBusInfo( ConnectAgent... param)
    {
        SellerEntity jc = (SellerEntity)Remote(param, SellerEntity.class,AccountCtrl.Account_Server_id,"app_server", new SellerEntity(),"getinfo",true,true);

        return jc;

    }
    // 审核失败商家信息
    public SellerEntity GetFailBusInfo( ConnectAgent... param)
    {
        SellerEntity obj= new SellerEntity(  ) ;

        SellerEntity jc = (SellerEntity)Remote(param, SellerEntity.class,AccountCtrl.Account_Server_id,"app_server", obj,"GetFailBusInfo",true,true);

        return jc;

    }
    //获得地址信息 带价格， 适用于发布热销信息
    public IGeoEntityCtrl GetGeoinfoP ( int gi_id, int prev_id,   String type , ConnectAgent... param)
    {
        IGeoEntityCtrl jc = (IGeoEntityCtrl)Remote(param, IGeoEntityCtrl.class,AccountCtrl.Account_Server_id,"app_server",  new GeoInfoEntity( "getlist", gi_id, prev_id,   type ),"getlist",true,true);

        return jc;

    }

    //生成提货码
    public DeliveryCodeEntity createDeliveryCode ( int to_id,String memo, ConnectAgent... param)
    {
        DeliveryCodeEntity obj=new DeliveryCodeEntity();
        obj.setToId(to_id);
        obj.setMemo(memo);
        DeliveryCodeEntity jc = (DeliveryCodeEntity)Remote(param, DeliveryCodeEntity.class,AccountCtrl.Account_Server_id,"app_server",  obj,"createDeliveryCode",true,true);

        return jc;

    }
    //核销提货码
    public IAcross closeDeliveryCode ( String code, ConnectAgent... param)
    {
        DeliveryCodeEntity obj=new DeliveryCodeEntity();
        obj.setCode(code);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",  obj,"closeDeliveryCode",true,true);

        return jc;

    }

    //提货码明细
    public  DeliveryCodeEntity getDeliveryCodeList (int start,int pagesize, ConnectAgent... param)
    {
        DeliveryCodeEntity obj=new DeliveryCodeEntity();
        obj.start=start;
        obj.pagesize=pagesize;
        DeliveryCodeEntity jc = (DeliveryCodeEntity)Remote(param, DeliveryCodeEntity.class,AccountCtrl.Account_Server_id,"app_server",  obj,"getDeliveryCodeList",true,true);

        return jc;

    }
    //查看提货码
    public DeliveryCodeEntity deliveryCodeInfo ( String code, ConnectAgent... param)
    {
        DeliveryCodeEntity obj=new DeliveryCodeEntity();
        obj.setCode(code);
        DeliveryCodeEntity jc = (DeliveryCodeEntity)Remote(param, DeliveryCodeEntity.class,AccountCtrl.Account_Server_id,"app_server",  obj,"deliveryCodeInfo",true,true);

        return jc;

    }
    //查看提货码
    public DeliveryCodeEntity deliveryCodeInfo ( int id, ConnectAgent... param)
    {
        DeliveryCodeEntity obj=new DeliveryCodeEntity();
        obj.setDcId(id);
        DeliveryCodeEntity jc = (DeliveryCodeEntity)Remote(param, DeliveryCodeEntity.class,AccountCtrl.Account_Server_id,"app_server",  obj,"deliveryCodeInfo",true,true);

        return jc;

    }
    /*********************积分代金券*****************************/
    //总积分
    public  IpointsCtrl getTotalPoints(int login_id, ConnectAgent... param)
    {
        IpointsCtrl jc = (IpointsCtrl)Remote(param, IpointsCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new PointsEntity( "getTotalPoints", login_id, null,null ,0,0),"getTotalPoints",true,true);

        return jc;

    }
    //积分明细
    public  IpointsCtrl getPointsList(int login_id,int start,int pagesize, ConnectAgent... param)
    {
        IpointsCtrl jc = (IpointsCtrl)Remote(param, IpointsCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new PointsEntity( "getPointsList", login_id, null,null,start,pagesize),"getPointsList",true,true);

        return jc;

    }
    //   添加可兑换产品
    public IAcross addExProduct(ExProductEntity e, ConnectAgent... param)
    {
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",   e,"addProduct",true,true);

        return jc;

    }
    //   删除可兑换产品
    public IAcross delExProduct(int exp_id, ConnectAgent... param)
    {
        ExProductEntity e=new ExProductEntity();
        e.setExpId(exp_id);

        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",   e,"del",true,true);

        return jc;


    }
    //   修改可兑换产品
    public IAcross modExProduct(ExProductEntity e, ConnectAgent... param)
    {
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",   e,"mod",true,true);

        return jc;

    }
    //可兑换产品列表
    public  IExChangeCtrl getProductList(int start,int pagesize, ConnectAgent... param)
    {
        IExChangeCtrl jc = (IExChangeCtrl)Remote(param, IExChangeCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new ExProductEntity( "getProductList", 0, null,null ,null,null,1,null,start,pagesize),"getProductList",true,true);

        return jc;

    }
    //可兑换产品列表
    public  IExChangeCtrl getProductList(Integer status, int start,int pagesize, ConnectAgent... param)
    {
        IExChangeCtrl jc = (IExChangeCtrl)Remote(param, IExChangeCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new ExProductEntity("getProductList", 0, null,null ,null,null,status,null,start,pagesize),"getProductList",true,true);

        return jc;

    }
    //可对兑换产品详情
    public ExProductEntity getProductInfo(int exp_id, ConnectAgent... param)
    {
        ExProductEntity jc = (ExProductEntity)Remote(param, ExProductEntity.class,AccountCtrl.Account_Server_id,"app_server",   new ExProductEntity( "getProductInfo", exp_id, null,null ,null,null,null,null,0,0),"getProductInfo",true,true);

        return jc;

    }
    //积分兑换
    // exp_id  可兑换产品id
    // type 见枚举 ExChangeType
    public   IAcross exChange(int login_id,int exp_id,int type, ConnectAgent... param)
    {
        ExchangeEntity log=new    ExchangeEntity("exChange",login_id,exp_id,type);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",  log,"exChange",true,true);

        return jc;
    }

    //我的代金券列表
    //status 1有效  null所有
    public  IExChangeCtrl getProListByLogin(int login_id,Integer status,int start,int pagesize, ConnectAgent... param)
    {
        IExChangeCtrl jc = (IExChangeCtrl)Remote(param, IExChangeCtrl.class,AccountCtrl.Account_Server_id,"app_server",     new VoucherEntity( "getProductList", 0,null, login_id,null ,null,null,null,status,start,pagesize),"getProductList",true,true);

        return jc;

    }
    // 代金券详情
    public  VoucherEntity getVoucherInfo(int voucher_id, ConnectAgent... param)
    {
        VoucherEntity jc = (VoucherEntity)Remote(param, VoucherEntity.class,AccountCtrl.Account_Server_id,"app_server",       new VoucherEntity( "voucherInfo", voucher_id,null, null,null ,null,null,null,null,0,0),"voucherInfo",true,true);

        return jc;
    }
    // 代金券详情
    public  VoucherEntity getVoucherInfo(String  voucher_code, ConnectAgent... param)
    {
        VoucherEntity jc = (VoucherEntity)Remote(param, VoucherEntity.class,AccountCtrl.Account_Server_id,"app_server",       new VoucherEntity( "voucherInfoByCode", 0,voucher_code, null,null ,null,null,null,null,0,0),"voucherInfoByCode",true,true);

        return jc;

    }

    //可用代金券
    public  IExChangeCtrl getAvailableVoucherList(int order_id, ConnectAgent... param)
    {
        VoucherEntity voucherEntity=new VoucherEntity();
        voucherEntity.setTargetId(order_id);
        IExChangeCtrl jc = (IExChangeCtrl)Remote(param, IExChangeCtrl.class,AccountCtrl.Account_Server_id,"app_server",    voucherEntity,"getAvailableVoucherList",true,true);

        return jc;

    }
    /************************支付************************/
    //新加 支付宝支付参数
    public  IAplipay  getAplipayOrderInfo(String orderno,BigDecimal amout,String payname,int voucherid, ConnectAgent... param)
    {
        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",       new IAplipay("getAplipayOrderInfo",orderno, amout,payname,"type=pay&voucherid="+voucherid),"getAplipayOrderInfo",true,true);

        return jc;
    }
    //支付宝异步返回处理
    public  IAplipay checkResult( String jsontext, ConnectAgent... param)
    {
        IAplipay obj= new IAplipay();
        obj.otherparams=jsontext;
        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",    obj,"CheckResult",true,true);

        return jc;
    }



    //支付宝退款
    public  IAplipay refund(String orderno,String tradeno,BigDecimal amount, ConnectAgent... param)
    {
        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",      new IAplipay("refund",orderno,tradeno,amount),"refund",true,true);

        return jc;

    }
    //微信支付 新加
    public  IAplipay  wxpay(String orderno,BigDecimal amout,String payname,int voucherid, ConnectAgent... param)
    {
        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",      new IAplipay("wxpay",orderno, amout,payname,"type=pay&voucherid="+voucherid),"wxpay",true,true);

        return jc;

    }
    //微信异步返回处理    新加
    public  IAplipay checkResultWX(String notityXml, ConnectAgent... param)
    {
        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",      new IAplipay("checkResultWX",notityXml),"checkResultWX",true,true);

        return jc;

    }
    //新加   线下付款
    public IAcross payOffLine(int order_id, ConnectAgent... param)
    {
        IOrder obj=new  IOrder("payOffLine",order_id);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",     obj,"payOffLine",true,true);

        return jc;
    }


    //获取资金总额客户端
    public CapitalAccEntity getCapitalTotalC( ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        CapitalAccEntity jc = (CapitalAccEntity)Remote(param, CapitalAccEntity.class,AccountCtrl.Account_Server_id,"app_server",     obj,"getCapitalTotalC",true,true);

        return jc;
    }
    //获取资金总额施工端
    public CapitalAccEntity getCapitalTotalS( ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        CapitalAccEntity jc = (CapitalAccEntity)Remote(param, CapitalAccEntity.class,AccountCtrl.Account_Server_id,"app_server",     obj,"getCapitalTotalC",true,true);

        return jc;
    }

    //  普通用户支付宝充值
    public  IAplipay  getAplipayRehargeC(BigDecimal amout,String payname, ConnectAgent... param)
    {
        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",       new IAplipay("","", amout,payname,"type=recharge"),"getAplipayRehargeC",true,true);

        return jc;
    }
    // 商户支付宝充值
    public  IAplipay  getAplipayRehargeS(BigDecimal amout,String payname, ConnectAgent... param)
    {
        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",       new IAplipay("","", amout,payname,"type=recharge"),"getAplipayRehargeS",true,true);

        return jc;
    }

    //普通用户微信充值
    public  IAplipay  wxRehargeC(BigDecimal amout,String payname, ConnectAgent... param)
    {
        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",      new IAplipay("","", amout,payname,"type=recharge"),"wxRehargeC",true,true);

        return jc;

    }
    //商户端微信充值
    public  IAplipay  wxRehargeS(BigDecimal amout,String payname, ConnectAgent... param)
    {
        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",      new IAplipay("","", amout,payname,"type=recharge"),"wxRehargeS",true,true);

        return jc;

    }

    //  转账发红包  paytype: 阿里alipay 微信wxpay 零钱pay  totype:商户seller, 个人login
    public  IAplipay  transfer(String paytype, BigDecimal amout,int toid,String totype, ConnectAgent... param)
    {
        IAplipay obj=new IAplipay(paytype,"", amout,"转账","type=transfer&toid="+toid+"&totype="+totype);
        obj.to_id=toid;
        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",   obj    ,"transfer",true,true);

        return jc;
    }
    //转账输入密码确认
    public  IAplipay  transferconfirm(String password,String returnString, ConnectAgent... param)
    {
        CapitalAccEntity capitalAccEntity=new    CapitalAccEntity();
        capitalAccEntity.setPassword(password);
        capitalAccEntity.setMmOpenid(returnString);
        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",      capitalAccEntity,"transferconfirm",true,true);

        return jc;
    }
    //资金流水客户端
    public IPayCtrl getPayListC (int start,int pagesize , ConnectAgent... param)
    {
        IPay ipay=  new IPay();
        ipay.start=start;
        ipay.pagesize=pagesize;
        IPayCtrl jc = (IPayCtrl)Remote(param, IPayCtrl.class,AccountCtrl.Account_Server_id,"app_server",  ipay,"getPayListC",true,true);

        return jc;
    }
    //资金流水商户端
    public IPayCtrl getPayListS (int start,int pagesize , ConnectAgent... param)
    {
        IPay ipay=  new IPay();
        ipay.start=start;
        ipay.pagesize=pagesize;
        IPayCtrl jc = (IPayCtrl)Remote(param, IPayCtrl.class,AccountCtrl.Account_Server_id,"app_server",  ipay,"getPayListS",true,true);

        return jc;
    }
    //收支详情
    public PaybackEntity getPayInfo(int payid, ConnectAgent... param)
    {
        IPay ipay=new   IPay();
        ipay.pay_id=payid;
        PaybackEntity jc = (PaybackEntity)Remote(param, PaybackEntity.class,AccountCtrl.Account_Server_id,"app_server",  ipay,"getPayInfo",true,true);

        return jc;
    }
    //支付宝提现
//    public  IAplipay transferFee(int acc_id,String acc_type,BigDecimal amount, ConnectAgent... param)
//    {
//        IAplipay jc = (IAplipay)Remote(param, IAplipay.class,AccountCtrl.Account_Server_id,"app_server",      new IAplipay("TransferFee",acc_id,acc_type,amount),"TransferFee",true,true);
//
//        return jc;
//
//    }
    //用户端提现申请 paytype： 支付宝enchash2ali ,微信enchash2wx;
    public  EnchashmentEntity transferFeeC(BigDecimal amount,String paytype, ConnectAgent... param)
    {
        EnchashmentEntity jc = (EnchashmentEntity)Remote(param, EnchashmentEntity.class,AccountCtrl.Account_Server_id,"app_server",      new EnchashmentEntity(amount,paytype),"transferFeeC",true,true);

        return jc;

    }
    //商户端提现申请 paytype： 支付宝enchash2ali ,微信enchash2wx;
    public  EnchashmentEntity transferFeeS(BigDecimal amount,String paytype, ConnectAgent... param)
    {
        EnchashmentEntity jc = (EnchashmentEntity)Remote(param, EnchashmentEntity.class,AccountCtrl.Account_Server_id,"app_server",      new EnchashmentEntity(amount,paytype),"transferFeeS",true,true);

        return jc;

    }
    //输入密码确认提现

    public  IAcross transferFeeConfirm(int applyid,String password, ConnectAgent... param)
    {
        CapitalAccEntity obj=new CapitalAccEntity();
        obj.setCaId(applyid);
        obj.setPassword(password);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",      obj,"transferFeeConfirm",true,true);

        return jc;

    }
    //提现列表 0待审核 1已通过 全部null
    public  IPayCtrl getEncashmentList(Integer status, ConnectAgent... param)
    {
        IPayCtrl jc = (IPayCtrl)Remote(param, IPayCtrl.class,AccountCtrl.Account_Server_id,"app_server",      new EnchashmentEntity(status),"getEncashmentList",true,true);

        return jc;
    }
    //提现审核
    public   IAcross confirmEncashment(int id, ConnectAgent... param)
    {
        EnchashmentEntity obj=new   EnchashmentEntity();
        obj.setId(id);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",      obj,"confirmEncashment",true,true);

        return jc;
    }
    //   客户端绑定支付宝账号
    public IAcross bindAlipayC(String aliacount, ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        obj.setAliAccount(aliacount);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",     obj,"bindAlipayC",true,true);

        return jc;
    }
    //   商户端绑定支付宝账号
    public IAcross bindAlipayS(String aliacount, ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        obj.setAliAccount(aliacount);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",     obj,"bindAlipayS",true,true);

        return jc;
    }
    //绑定微信
    public IAcross bindWX(String openid, ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        obj.setMmOpenid(openid);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",     obj,"bindWX",true,true);

        return jc;
    }
    //家帮忙账户总额 后台用
    public CapitalAccEntity getJBMTotal( ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        CapitalAccEntity jc = (CapitalAccEntity)Remote(param, CapitalAccEntity.class,AccountCtrl.Account_Server_id,"app_server",     obj,"getJBMTotal",true,true);

        return jc;
    }
    //   设置资金密码 客户
    public IAcross setCapitalPasswordC(String password, ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        obj.setPassword(password);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",     obj,"setCapitalPasswordC",true,true);

        return jc;
    }

    //   设置资金密码商户
    public IAcross setCapitalPasswordS(String password, ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        obj.setPassword(password);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",     obj,"setCapitalPasswordS",true,true);

        return jc;
    }
    //   修改资金密码 客户
    public IAcross resetCapitalPasswordC(String oldpass,String password, ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        obj.setPassword(password);
        obj.setMmOpenid(oldpass);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",     obj,"resetCapitalPasswordC",true,true);

        return jc;
    }
    //   修改资金密码 商户
    public IAcross resetCapitalPasswordS(String oldpass,String password, ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        obj.setPassword(password);
        obj.setMmOpenid(oldpass);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",     obj,"resetCapitalPasswordS",true,true);

        return jc;
    }

    //获取资金账号信息  客
    public CapitalAccEntity getCapInfoC( ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        CapitalAccEntity jc = (CapitalAccEntity)Remote(param, CapitalAccEntity.class,AccountCtrl.Account_Server_id,"app_server",     obj,"getCapInfoC",true,true);

        return jc;
    }

    //获取资金账号信息 商
    public CapitalAccEntity getCapInfoS( ConnectAgent... param)
    {
        CapitalAccEntity obj=new  CapitalAccEntity();
        CapitalAccEntity jc = (CapitalAccEntity)Remote(param, CapitalAccEntity.class,AccountCtrl.Account_Server_id,"app_server",     obj,"getCapInfoS",true,true);

        return jc;
    }

    //零钱支付订单 target 见枚举VoucherTargetType
    public IAcross balancePay(String orderno,BigDecimal amount,int voucherid,int target,String password, ConnectAgent... param)
    {
        //AliAccount 订单号  getAccId 优惠券id getCaId优惠券用于何处

        CapitalAccEntity obj=new  CapitalAccEntity();
        obj.setAliAccount(orderno);
        obj.setAmount(amount);
        obj.setAccId(voucherid);
        obj.setCaId(target);
         obj.setPassword(password);
        IAcross jc = (IAcross)Remote(param,IAcross.class,AccountCtrl.Account_Server_id,"app_server",     obj,"balancePay",true,true);

        return jc;
    }
    /********************地理信息**************************/
    public IGeoinfoCtrl GetGeoinfo ( int gi_id, int prev_id, String prev_code, String type , ConnectAgent... param)
    {
        IGeoinfoCtrl jc = (IGeoinfoCtrl)Remote(param, IGeoinfoCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IGeoinfo( "getlist", gi_id, prev_id, prev_code, type,"t"),"getlist",true,true);

        return jc;

    }

    //gi_type：c公产房 z公租房 j 我爱我家  t通用
    public IGeoinfoCtrl GetGeoinfo ( int gi_id, int prev_id, String prev_code, String type ,String gi_type, ConnectAgent... param)
    {
        IGeoinfoCtrl jc = (IGeoinfoCtrl)Remote(param, IGeoinfoCtrl.class,AccountCtrl.Account_Server_id,"app_server",   new IGeoinfo( "getlist", gi_id, prev_id, prev_code, type,gi_type),"getlist",true,true);

        return jc;

    }
    /*************************其他*************************/
    //点击数记录
    // type见枚举ClickTimesType
    // mainid 信息id 若天气传null
    // 若登录传  login_id 未登录传serialUmber
    public void addClickTimes(Integer login_id,int type,Integer mainid,String serialUmber, ConnectAgent... param)
    {
        Remote(param, AccountCtrl.Account_Server_id,"app_server",         new ClickTimesEntity( "add", login_id,type, mainid,serialUmber),"add",true,true,false,false);

    }

    //修改配置信息x
    public IAcross modConfig(int type,String value, ConnectAgent... param)
    {
        OtherconfigEntity obj=new  OtherconfigEntity("mod",type,value);
        IAcross jc = (IAcross)Remote(param, IAcross.class,AccountCtrl.Account_Server_id,"app_server",    obj,"mod",true,true);

        return jc;
    }

    // 获取配置列表
    public  IOtherConfigCtrl getConfiglist(int type , ConnectAgent... param)
    {
        IOtherConfigCtrl jc = (IOtherConfigCtrl)Remote(param, IOtherConfigCtrl.class,AccountCtrl.Account_Server_id,"app_server",       new OtherconfigEntity( "getlist", type,null),"getlist",true,true);

        return jc;

    }


    /* 获得天气信息*/
    public IWeatherCtrl GetWeatherInfo ( ConnectAgent... param)
    {
        IWeather obj=   new IWeather( "getinfo" ) ;
        IWeatherCtrl jc = (IWeatherCtrl)Remote(param, IWeatherCtrl.class,AccountCtrl.Account_Server_id,"app_server",  obj,"getinfo",true,true);

        return jc;


    }
//    public IGeoinfo CreateGeoUnit ( String , ConnectAgent... param)

    //意见反馈
    public IAPPJudge CreateAPPJudge ( String keyword, String message , ConnectAgent... param)
    {
        IAPPJudge jc = (IAPPJudge)Remote(param, IAPPJudge.class,AccountCtrl.Account_Server_id,"app_server",  new IAPPJudge( "create", login_id, keyword, message),"create",true,true);

        return jc;

    }

    public IAppVersion GetLastVersion ( String app_code, int major_ver, int minor_ver, int revision_ver, int build , ConnectAgent... param)
    {
        IAppVersion jc = (IAppVersion)Remote(param, IAppVersion.class,AccountCtrl.Account_Server_id,"app_server",  new IAppVersion( "confirm", app_code, major_ver, minor_ver, revision_ver, build),"confirm",true,true);

        return jc;

    }
    public static int BUFFER_LEN = 65536;
    public Media UploadMedia ( int folderid, String foldertype, Media media , ConnectAgent... param)
    {
        try
        {
            if ( !media.mtype.equals("text") )
            {
                IUploadMedia ium = new IUploadMedia( folderid, foldertype, media );
                ium.buffer = new byte[BUFFER_LEN];
                //ium.method="uploadMedia" ;

                Media jc;
                if ( media.mid == 0 && media.offset > 0 )
                {
                    media.offset = -1;
                    return media;
                }
                RandomAccessFile raf = new RandomAccessFile(media.filepath,"r");
                media.filepath = "";
                raf.seek(media.offset);

                int len;
                do
                {
                    len = raf.read(ium.buffer,0,BUFFER_LEN);

                    ium.bufferlen = len==-1?0:len;

                    jc = (Media)Remote(param, Media.class,AccountCtrl.Account_Server_id,"app_server",  ium,"uploadMedia",true,true);
                    if(jc.m_code==200) {
                        if (jc.offset != -1) {
                            ium.media.offset = jc.offset;
                            ium.media.mid = jc.mid;
                            ium.media.filepath = jc.filepath;
                        } else
                            return jc;
                    }else
                    {
                        jc.offset = -1;
                        return jc;
                    }


                }while ( len != -1 );

                raf.close();

                return jc;
            }else
            {
                IUploadMedia ium=  new IUploadMedia(folderid, foldertype, media)  ;
                ium.method="uploadMedia" ;
                Media jc = (Media)Remote(param, Media.class,AccountCtrl.Account_Server_id,"app_server",  ium,"uploadMedia",true,true);

                return jc;
            }
        }catch (Exception e)
        {
            media.offset = -1;
            return media;
        }
    }
    public Media PutMediaBlock( IUploadMedia ium , ConnectAgent... param)
    {
        Media jc;
        jc = (Media)Remote(param, Media.class,AccountCtrl.Account_Server_id,"app_server",  ium,"uploadMedia",true,true);
        if(jc.m_code!=200)
        {
            jc = new Media();
            jc.offset = -1;
        }
        return jc;


    }
    public IDownloadMedia DownloadMedia ( int folderid, String foldertype, Media media , ConnectAgent... param)
    {
        IDownloadMedia idm = new IDownloadMedia( folderid, foldertype, media );
        idm.method="downMedia";
        String localpath = media.filepath;
        idm.media.filepath = "";
        RandomAccessFile raf = null;
        try
        {
            if ( !media.mtype.equals("text") )
            {
                IDownloadMedia rtn;

                if ( media.mid <= 0 )
                {
                    idm.media.offset = -1;
                    return idm;
                }

                do
                {
                    rtn = (IDownloadMedia)Remote(param, IDownloadMedia.class,AccountCtrl.Account_Server_id,"app_server",  idm,"downMedia",true,true);
                    if ( rtn.media.offset != -1 )
                    {
                        if ( raf == null )
                        {
                            raf = new RandomAccessFile(localpath+rtn.media.filename, "rw");
                            raf.seek(media.offset);
                        }

                        idm.media.offset = rtn.media.offset;
                        idm.media.mid = rtn.media.mid;
                        idm.media.filepath = rtn.media.filepath;
                        idm.media.filename = rtn.media.filename;

                        if ( rtn.bufferlen > 0 )
                            raf.write(rtn.buffer,0,rtn.bufferlen);
                    }else
                    {
                        if ( raf != null )
                            raf.close();;
                        return rtn;
                    }


                }while ( rtn.bufferlen > 0 );

                raf.close();

                return rtn;
            }else
            {

                IDownloadMedia jc = (IDownloadMedia)Remote(param, IDownloadMedia.class,AccountCtrl.Account_Server_id,"app_server",  idm,"downMedia",true,true);
                if(jc.m_code!=200) {
                    idm.media.offset = -1;
                    return idm;
                }
                return jc;

            }
        }catch (Exception e)
        {
            idm.media.offset = -1;
            return idm;
        }
    }

    public InputStream InputStreamMedia (int folderid, String foldertype, Media media, ConnectAgent... param)
    {
        if ( param.length == 0 )
            return new PicInputStream( folderid, foldertype, media, this, null );
        else
            return new PicInputStream( folderid, foldertype, media, this, param[0] );
    }

    public IDownloadMedia GetMediaBlock( IDownloadMedia idm , ConnectAgent... param)
    {
        IDownloadMedia jc = (IDownloadMedia)Remote(param, IDownloadMedia.class,AccountCtrl.Account_Server_id,"app_server",  idm,"downMedia",true,true);
        if(jc.m_code!=200) {
            idm.media.offset = -1;
            return idm;
        }
        return jc;

    }


    public OutputStream OutputStreamMedia (int folderid, String foldertype, Media media , ConnectAgent... param)
    {
        if ( media.mid == 0 && media.offset > 0 )
        {
            media.offset = -1;
            return null;
        }

        if ( param.length == 0 )
            return new PicOutputStream( folderid, foldertype, media, this, null );
        else
            return new PicOutputStream( folderid, foldertype, media, this, param[0] );
    }

    public LoginEntity GetLogin ( String mobile, String email, String mm_unionid , ConnectAgent... param)
    {
        LoginEntity jc = (LoginEntity)Remote(param, LoginEntity.class,AccountCtrl.Account_Server_id,"app_server",  new AccSecretEntity( mobile, email, mm_unionid ),"GetLogin",true,true);

        return jc;

    }

    public LoginEntity GetLogin ( int login_id, String mobile, String email, String mm_unionid , ConnectAgent... param)
    {
        LoginEntity jc = (LoginEntity)Remote(param, LoginEntity.class,AccountCtrl.Account_Server_id,"app_server",  new AccSecretEntity( login_id, mobile, email, mm_unionid ),"GetLoginAll",true,true);

        return jc;

    }

    public PrivilegeListEntity getTotalPrivilegeList ( boolean recursion, int grp_pri_id, String grp_pri_code, ConnectAgent... param )
    {
        LoginEntity le = new LoginEntity();

        le.recursion = recursion;
        le.grp_pri_id = grp_pri_id;
        le.grp_pri_code = grp_pri_code;

        return (PrivilegeListEntity)Remote(param,PrivilegeListEntity.class,AccountCtrl.Account_Server_id,"app_server",le, "getTotalPrivilegeList",true,true);
    }

    public PrivilegeListEntity getPersonalPrivilegeList ( boolean recursion, int fun_id, int login_id, ConnectAgent... param )
    {
        LoginEntity le = new LoginEntity();

        le.recursion = recursion;
        le.setFunId(fun_id);
        le.setFunId(fun_id);
        le.setLoginId(login_id);

        return (PrivilegeListEntity)Remote(param,PrivilegeListEntity.class,AccountCtrl.Account_Server_id,"app_server",le, "getPersonalPrivilegeList",true,true);
    }

    public IAcross addPrivilege ( int fun_id, int pri_id, int login_id, String pri_code, ConnectAgent... param )
    {
        LoginEntity le = new LoginEntity();

        le.pri_id = pri_id;
        le.pri_code = pri_code;
        le.setFunId(fun_id);
        le.setLoginId(login_id);

        return (PrivilegeListEntity)Remote(param,PrivilegeListEntity.class,AccountCtrl.Account_Server_id,"app_server",le, "addPrivilege",true,true);
    }

    public IAcross removePrivilege ( int fun_id, int pri_id, int login_id, String pri_code, ConnectAgent... param )
    {
        LoginEntity le = new LoginEntity();

        le.pri_id = pri_id;
        le.pri_code = pri_code;
        le.setFunId(fun_id);
        le.setLoginId(login_id);

        return (PrivilegeListEntity)Remote(param,PrivilegeListEntity.class,AccountCtrl.Account_Server_id,"app_server",le, "removePrivilege",true,true);
    }

    public IOrderCtrl getUnPayList(int start,int pagesize , ConnectAgent... param)
    {
        IOrder iorder=  new IOrder();
        iorder.start=start;
        iorder.pagesize=pagesize;
        IOrderCtrl oe = (IOrderCtrl)Remote(param, IOrderCtrl.class,AccountCtrl.Account_Server_id,"app_server",  iorder,"getUnPayList",true,true);

        return oe;
    }
}
